import typing
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication,QMainWindow
import sys
from qt_material import apply_stylesheet
from ui.Ui_my_main_window import Ui_MyMainWindow
from qt_material import list_themes
class MyMianWindow(QMainWindow):

    def __init__(self):
        super().__init__()
    
        self.ui = Ui_MyMainWindow()
        self.ui.setupUi(self)
        self.counter = 0
        self.init_ui()
        
    def on_click(self):    
        self.ui.statusBar.showMessage(f"按钮被点击了{self.counter}次")
        self.counter += 1
        
    def on_refresh(self):
        print("刷新")    
        
    def init_ui(self):   
        self.ui.pushButton_3.clicked.connect(self.on_click)
        self.ui.actionExit.triggered.connect(QApplication.quit)
        self.ui.actionrefresh.triggered.connect(self.on_refresh)

        
    
    
if __name__ == '__main__':
    
    # 1.创建应用程序
    app = QApplication(sys.argv)
    
    # 2.创建窗口
    w = MyMianWindow()
    apply_stylesheet(app, theme='light_pink_500.xml')
    list_themes()
    
    for i in list_themes():
        print(i)
    # 3.显示窗口
    w.show()
    # 4.等待窗口停止
    sys.exit(app.exec())